/**
* 描述：职位邀请
*/
<style lang="scss" scoped>
  @import 'src/styles/company/index';
</style>
<template>
  <div class="content">
    <div class="com-main-title">
      <span class="tit">简历中心</span>
      <div class="clear"></div>
    </div>
    <!--搜索条部分-->
    <div class="search-bar">
      <div class="oneImput fl wth160px">
        <el-input v-model="searchData.job" placeholder="职位" size="small"></el-input>
      </div>
      <div class="oneImput fl wth160px">
        <el-select placeholder="学历学位" v-model="searchData.education" clearable>
          <el-option :value="0" :key="0" :label="'中专'"></el-option>
          <el-option :value="1" :key="1" :label="'大专'"></el-option>
          <el-option :value="2" :key="2" :label="'本科'"></el-option>
          <el-option :value="3" :key="3" :label="'硕士'"></el-option>
          <el-option :value="4" :key="4" :label="'博士'"></el-option>
          <el-option :value="5" :key="5" :label="'其它'"></el-option>
        </el-select>
      </div>
      <div class="oneImput fl wth160px">
        <el-select v-model="searchData.salary" placeholder="期望薪资" filterable>
          <el-option v-for="item in salaryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
        </el-select>
      </div>
      <!--<div class="oneImput fl wth160px">-->
        <!--<el-select placeholder="工作经验" v-model="searchData.workExperience" clearable>-->
          <!--<el-option :value="-1" :key="-1" :label="'1年以下'"></el-option>-->
          <!--<el-option :value="1" :key="1" :label="'1－3年'"></el-option>-->
          <!--<el-option :value="2" :key="2" :label="'3－5年'"></el-option>-->
          <!--<el-option :value="3" :key="3" :label="'5－10年'"></el-option>-->
          <!--<el-option :value="10" :key="10" :label="'10年以上'"></el-option>-->
        <!--</el-select>-->
      <!--</div>-->
      <div class="oneImput fr">
        <el-button type="primary" class="search-button fl" icon="search" @click="search" size="small">搜索</el-button>
        <div class="clear"></div>
      </div>
      <div class="clear"></div>
    </div>

    <!--table部分-->
    <div class="table-content">
      <el-table
        size="mini"
        :data="list"
        v-loading="loading"
        :element-loading-text="loadingText"
        highlight-current-row
        border
        style="width: 100%">
        <el-table-column
          prop="name"
          label="姓名"
          align="center"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="receivedAt"
          label="性别"
          align="center"
          show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.sex | sexType }}
          </template>
        </el-table-column>
        <el-table-column
          prop="birth"
          align="center"
          label="年龄"
          show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.birth | jsGetAge }}
          </template>
        </el-table-column>
        <!--<el-table-column-->
          <!--prop="status"-->
          <!--label="工作年限"-->
          <!--align="center"-->
          <!--show-overflow-tooltip>-->
        <!--</el-table-column>-->
        <el-table-column
          prop="education"
          label="学历"
          align="center"
          show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.education | education }}
          </template>
        </el-table-column>
        <el-table-column
          prop="status"
          label="薪资"
          align="center"
          show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.salary | salaryState }}
          </template>
        </el-table-column>
        <el-table-column
          prop="job"
          label="职位"
          align="center"
          show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="createdAt"
          label="更新时间"
          align="center"
          show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.createdAt | formatDate2 }}
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="70px" fixed="right">
          <template slot-scope="scope">
            <a class="cz" @click="lookResume(scope.row.talentId)">查看简历</a>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <hy-page v-show="pageShow"
               :current-page="searchData.page"
               :page-size="searchData.limit"
               :total-element="totalElement"
               @current-change="currentChange"></hy-page>
    </div>
  </div>
</template>
<script>
  import list from '@/js/mixins/list';
  import { queryList, queryCount } from '@/service/company/talentPool/talentPoolMService';
  import hyHandler from '@/components/handler/handler';
  export default {
    mixins: [list],
    components: {
      hyHandler
    },
    data () {
      return {
        loading: true,
        searchData: {},
        statusList: [
          {value: 1, label: '已发出邀约'},
          {value: 2, label: '已接受邀约'},
          {value: 3, label: '已入职'}
        ],
        jobList: [],
        salaryList: [
          {value: 0, label: '面议'},
          {value: 1, label: '1000-2000'},
          {value: 2, label: '2000-3000'},
          {value: 3, label: '3000-4000'},
          {value: 4, label: '4000-5000'},
          {value: 5, label: '5000-8000'},
          {value: 6, label: '8000-10000'},
          {value: 7, label: '10000-15000'},
          {value: 8, label: '15000-20000'},
          {value: 9, label: '20000-30000'},
          {value: 10, label: '30000-50000'},
          {value: 11, label: '50000-100000'},
          {value: 12, label: '100000以上'}
        ]
      };
    },
    methods: {
      async _getList () {
        this.loading = true;
        let result = await queryList(this.searchData);
        let temp = await queryCount(this.searchData);
        if (!result.data.length) result.data = null;
        this.list = result.data || [];
        this.totalElement = temp.data || 0;
        this.loading = false;
      },
      // 查看简历
      lookResume (id) {
        this.$router.push({path: '/company/main/talentPool/detail', query: {id: id}});
      }
    }
  };
</script>
